<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<script>
    autoCompleteClinic("clinicName");
    function autoCompleteClinic(inputId) {
        var url = "${ctx}/oper/clinicItemDict/automatic?itemClass=C,D";
        autoComplete(inputId, url,
                function (data) {
                    var rows = [];
                    for (var i = 0; i < data.length; i++) {
                        rows[rows.length] = {
                            data: data[i],
                            value: data[i].id,
                            result: data[i].itemName
                        };
                    }
                    return rows;
                }, function (data, i, max) {
                    return data.itemName + "|   " + data.itemCode + "|   " + data.price+"元";
                }, function (event, data, formatted) {
                    $("#clinicId").val(data.id);
                })
    }
</script>
<div class="content-wrap">
        <div class="wrapper" style="bottom: 50px;">
            <ul class="nav nav-tabs">
                <li>
                    <a href="#"  onclick="loadDiv('mainCenterDiv','${ctx}/sys/titemcomobo/tItemComobo/index')">列表</a>
                </li>
                <li class="active">
                    <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/tComobVsClinic/tComobVsClinic/form?comoboId=${tComobVsClinic.comoboId}&clinicName=${clinicName}')">
                        <c:choose>
                            <c:when test="${tComobVsClinic.id==''|| tComobVsClinic.id==null}">
                                添加套餐项目
                            </c:when>
                            <c:otherwise>修改</c:otherwise>
                        </c:choose>
                    </a>
                </li>
            </ul>
            <section class="panel panel-default">
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-7">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <form:form id="searchForm"  class="form-inline">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label">套餐名称：</label>
                                                <div class="col-sm-4 ">
                                                    <input name="ictemCode" readonly class="form-control"  maxlength="50" value="${clinicName}"/>
                                                </div>
                                            </div>
                                        </form:form>
                                     </div>
                                </div>
                        <table id="contentTable" class="table table-bordered mg-t datatable">
                            <thead>
                            <tr>
                                <th style="display: none">分组ID</th>
                                <th style="display: none">ID</th>
                                <th>诊疗项目</th>
                                <th>收费系数</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${list}" var="tComobVsClinic">
                            <tr>
                                <td style="display: none"> ${tComobVsClinic.comoboId}</td>
                                <td style="display: none"> ${tComobVsClinic.id}</td>
                                <td> ${tComobVsClinic.clinicId}</td>
                                <td> ${tComobVsClinic.coefficient}</td>
                                <td>
                                    <a href="#"  class="applyBt btn btn-danger btn-xs" onclick="confirmExtend('确认要删除该吗？',function(){delLoad('mainCenterDiv','${ctx}/tComobVsClinic/tComobVsClinic/delete?id=${tComobVsClinic.id}','${ctx}/tComobVsClinic/tComobVsClinic/form?comoboId=${tComobVsClinic.comoboId}&clinicName=${clinicName}')})">删除</a>
                                </td>
                            </tr>
                            </c:forEach>

                        </table>
                    </div>
                        </div>
                        <div class="col-lg-5" >
                        <form:form id="inputForm" data-parsley-validate="" modelAttribute="tComobVsClinic" onsubmit="return formSaveLoad('mainCenterDiv','inputForm','${ctx}/tComobVsClinic/tComobVsClinic/save','${ctx}/tComobVsClinic/tComobVsClinic/form?comoboId=${tComobVsClinic.comoboId}&clinicName=${clinicName}');" method="post" class="form-horizontal">
                            <form:hidden path="id"/>
                            <form:hidden path="clinicId"/>
                            <form:hidden path="comoboId" value="${tComobVsClinic.comoboId}"/>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目名称：</label>
                                    <div class="col-sm-4">
                                        <form:input path="" id="clinicName" htmlEscape="false" class="form-control"  maxlength="64" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">收费系数：</label>
                                    <div class="col-sm-4">
                                        <form:input min="0" path="coefficient" value="1" htmlEscape="false" class="form-control"  />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存">&nbsp;
                                        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="loadDiv('mainCenterDiv','${ctx}/sys/titemcomobo/tItemComobo/index')">
                                </div>
                            </div>
                        </form:form>
                    </div>
            </div>
                </div>
            </section>
        </div>
    </div>